package com.project.lk.nurseapp.home.presenter;

import com.project.lk.nurseapp.base.BaseApi;
import com.project.lk.nurseapp.base.BasePresenter;
import com.project.lk.nurseapp.base.ModelPresenterBridge;
import com.project.lk.nurseapp.home.model.UserModel;
import com.project.lk.nurseapp.login.model.UserBean;

import java.util.List;

/**
 * 功能介绍：
 * 项目名：
 * 模块名称：
 * 作者：LK
 * 日期：2018/1/9
 * 修改日期：
 */
public class UserPresenter extends BasePresenter<IUserView> implements ModelPresenterBridge{
    UserModel userModel;
    public UserPresenter(IUserView view){
        userModel=new UserModel();
        addView(view);
        userModel.setBridge(this);

    }

    public List<UserBean> getUserBean(){

        return userModel.getmList();
    }
    public void loadUserData(String url){
        userModel.postLoadJson(url);
    }

    @Override
    public void bridge(int action, List list) {
        if (view!=null){
            switch (action){
                case BaseApi.success:
                    view.returnSuccess();
                    break;
                case BaseApi.fail:
                    view.fail();
                    break;

            }
        }
    }
}
